<!--
 * createor: zc
 * email: zc8023zs@163.com
 * create_time: 2020/3/14 13:46:24
 *-->
<template>
  <el-container>
    <el-header>
      满减优惠详情
    </el-header>
    <el-main>
      <el-form label-width="200px" :inline="true" style="padding:5% 5% 0 5%">
        <el-form-item label="标识id：">
          <span>{{formData.discount_off_id}}</span>
        </el-form-item>
        <el-form-item label="运营中心id：">
          <span>{{formData.oc_id}}</span>
        </el-form-item>
        <el-form-item label="店铺/门店id：">
          <span>{{formData.shop_id}}</span>
        </el-form-item>
        <el-form-item label="满减条件：">
          <span>{{formData.full_money}}</span>
        </el-form-item>
        <el-form-item label="减免金额：">
          <span>{{formData.off_money}}</span>
        </el-form-item>
        <el-form-item label="时间类型：">
          <span>{{formData.time_type}}</span>
        </el-form-item>
        <el-form-item label="开始时间：">
          <span>{{formData.start_time}}</span>
        </el-form-item>
        <el-form-item label="结束时间：">
          <span>{{formData.end_time}}</span>
        </el-form-item>
        <el-form-item label="创建时间：">
          <span>{{formData.create_time}}</span>
        </el-form-item>
        <el-form-item label="是否可用：">
          <span>{{formData.enabled}}</span>
        </el-form-item>
        <el-form-item label="数据版本字段：">
          <span>{{formData.version_id}}</span>
        </el-form-item>
      </el-form>
    </el-main>
  </el-container>
</template>
<style scoped>
body .app-container .el-container,
body .app-container .el-header,
body .app-container .el-main,
body .el-container,
body .el-header,
body .el-main {
  padding: 0;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
</style>
<script>
import { Loading } from "element-ui";
import {
  qr_discount_offInfo
} from '@/api/project/wmyw/project_wmyw_qr_discount_off'
export default {
  name: "a_wmywa_qr_discount_off_info",
  data() {
    return {
      infoLoading: false,
      formData:{
        discount_off_id: 0, 
        oc_id: 0, 
        shop_id: 0, 
        full_money: 0.0, 
        off_money: 0.0, 
        time_type: 0, 
        start_time: '2020/8/11 15:00:30', 
        end_time: '2020/8/11 15:00:30', 
        create_time: '2020/8/11 15:00:30', 
        enabled: 0, 
        version_id: 0, 
      }
    };
  },
  activated() {
    var result = location.search.match(new RegExp("[\?\&]id=([^\&]+)", "i"));
    if(result != null || result.length > 0){
      this.onInfo(result[1]);
    }
  },
  methods: {
    onInfo(id){
      this.infoLoading=true;
      qr_discount_offInfo({id:id}).then(r=>{
        this.formData.discount_off_id = r.dataSingle.discount_off_id, 
        this.formData.oc_id = r.dataSingle.oc_id, 
        this.formData.shop_id = r.dataSingle.shop_id, 
        this.formData.full_money = r.dataSingle.full_money, 
        this.formData.off_money = r.dataSingle.off_money, 
        this.formData.time_type = r.dataSingle.time_type, 
        this.formData.start_time = r.dataSingle.start_time, 
        this.formData.end_time = r.dataSingle.end_time, 
        this.formData.create_time = r.dataSingle.create_time, 
        this.formData.enabled = r.dataSingle.enabled, 
        this.formData.version_id = r.dataSingle.version_id, 
        this.infoLoading=false;
      }).catch(()=>{
        this.infoLoading=false;
      });
    }
  }
}
</script>
